import { S } from '../../s';
import { IPSAppDEUILogicNode } from '../../app/dataentity/ipsapp-deuilogic-node';
import { IPSDEUILogicLink } from './ipsdeuilogic-link';
import { IPSDEUILogicNode } from './ipsdeuilogic-node';
import { IPSDEUILogicNodeParam } from './ipsdeuilogic-node-param';
import { IPSDEUILogicParam } from './ipsdeuilogic-param';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEUILogicNodeImpl
  extends PSModelObjectImpl
  implements IPSDEUILogicNode, IPSAppDEUILogicNode
{
  get codeName(): string {
    return this.M.codeName;
  }

  protected dstpsdeuilogicparam: IPSDEUILogicParam;
  getDstPSDEUILogicParam(): IPSDEUILogicParam | null {
    return (
      this.dstpsdeuilogicparam ||
      (this.dstpsdeuilogicparam = this.fillObjectModel(
        S._1f1,
        this.M.getDstPSDEUILogicParam,
        S._382,
      ) as IPSDEUILogicParam)
    );
  }

  get height(): number {
    return this.M.height != null ? this.M.height : 0;
  }

  get leftPos(): number {
    return this.M.leftPos != null ? this.M.leftPos : 0;
  }

  get logicNodeType():
    | 'BEGIN'
    | 'PREPAREJSPARAM'
    | 'RESETPARAM'
    | 'COPYPARAM'
    | 'BINDPARAM'
    | 'APPENDPARAM'
    | 'SORTPARAM'
    | 'RENEWPARAM'
    | 'VIEWCTRLINVOKE'
    | 'VIEWCTRLFIREEVENT'
    | 'PFPLUGIN'
    | 'MSGBOX'
    | 'DEACTION'
    | 'DEDATASET'
    | 'DELOGIC'
    | 'DEUIACTION'
    | 'THROWEXCEPTION'
    | 'DEBUGPARAM'
    | 'END' {
    return this.M.logicNodeType;
  }

  protected psdeuilogiclinks: IPSDEUILogicLink[];
  getPSDEUILogicLinks(): IPSDEUILogicLink[] | null {
    return (
      this.psdeuilogiclinks ||
      (this.psdeuilogiclinks = this.fillChildListModel(
        this.M.getPSDEUILogicLinks,
        S._1e7,
      ) as IPSDEUILogicLink[])
    );
  }

  findPSDEUILogicLink(objKey: any): IPSDEUILogicLink | null {
    return this.getPSModel5(
      S._1e7,
      this.getPSDEUILogicLinks(),
      objKey,
    ) as IPSDEUILogicLink;
  }

  protected psdeuilogicnodeparams: IPSDEUILogicNodeParam[];
  getPSDEUILogicNodeParams(): IPSDEUILogicNodeParam[] | null {
    return (
      this.psdeuilogicnodeparams ||
      (this.psdeuilogicnodeparams = this.fillChildListModel(
        this.M.getPSDEUILogicNodeParams,
        S._1ef,
      ) as IPSDEUILogicNodeParam[])
    );
  }

  findPSDEUILogicNodeParam(objKey: any): IPSDEUILogicNodeParam | null {
    return this.getPSModel5(
      S._1ef,
      this.getPSDEUILogicNodeParams(),
      objKey,
    ) as IPSDEUILogicNodeParam;
  }

  protected pssyspfplugin: IPSSysPFPlugin;
  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    return (
      this.pssyspfplugin ||
      (this.pssyspfplugin = this.fillObjectModel(
        S._27c,
        this.M.getPSSysPFPlugin,
        S._2a7,
      ) as IPSSysPFPlugin)
    );
  }

  protected srcpsdeuilogicparam: IPSDEUILogicParam;
  getSrcPSDEUILogicParam(): IPSDEUILogicParam | null {
    return (
      this.srcpsdeuilogicparam ||
      (this.srcpsdeuilogicparam = this.fillObjectModel(
        S._1f1,
        this.M.getSrcPSDEUILogicParam,
        S._383,
      ) as IPSDEUILogicParam)
    );
  }

  get topPos(): number {
    return this.M.topPos != null ? this.M.topPos : 0;
  }

  get width(): number {
    return this.M.width != null ? this.M.width : 0;
  }

  get parallelOutput(): boolean {
    return this.M.parallelOutput != null ? this.M.parallelOutput : false;
  }
  get cls(): string {
    return 'PSDEUILogicNodeImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._1e9 || cls == S._1ea) return true;
    return super.instanceof(cls);
  }
}
